// FetionDialogWidnow.cpp
// Heihaier <admin@heihaier.org>
// http://www.heihaier.org

#include "FetionDialogWindow.h"

FetionDialogWindow::FetionDialogWindow(const Glib::ustring & label, const long uid)
{
	m_UID = uid;
	m_Label = label;
	
	// resize
	set_default_size(400, 300);

	// Notebook
	Gtk::Notebook * pNotebook = Gtk::manage(new Gtk::Notebook);
	add(*pNotebook);

	// VPaned
	Gtk::VPaned * pVPaned = Gtk::manage(new Gtk::VPaned);
	pNotebook->append_page(*pVPaned, label, FALSE);

	// VBox 1
	Gtk::VBox * pVBox = Gtk::manage(new Gtk::VBox);
	pVPaned->add1(*pVBox);

	// Label
	Gtk::Label * pLabel = Gtk::manage(new Gtk::Label);
	pLabel->set_alignment(0.0, 0.5);
	pVBox->pack_start(*pLabel, FALSE, TRUE, 0);

	// Scrolled Widnow 1
	Gtk::ScrolledWindow * pScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow);
	pScrolledWindow->set_shadow_type(Gtk::SHADOW_OUT);
	pVBox->pack_start(*pScrolledWindow, TRUE, TRUE, 0);

	// Unkown error ....
	pScrolledWindow->add(m_Output);

	// VBox 2
	pVBox = Gtk::manage(new Gtk::VBox);
	pVPaned->add2(*pVBox);

	// HButtonBox
	Gtk::HButtonBox * pHButtonBox = Gtk::manage(new Gtk::HButtonBox);
	pVBox->pack_start(*pHButtonBox, FALSE, FALSE, 0);

	// Button font
	Gtk::Button * pButton = Gtk::manage(new Gtk::Button("Font"));
	pButton->set_relief(Gtk::RELIEF_NONE);
	pHButtonBox->pack_start(*pButton, FALSE, FALSE, 0);

	// Button smile
	pButton = Gtk::manage(new Gtk::Button("Smile"));
	pButton->set_relief(Gtk::RELIEF_NONE);
	pHButtonBox->pack_start(*pButton, FALSE, FALSE, 0);

	// Scrolled Widnow 2
	pScrolledWindow = Gtk::manage(new Gtk::ScrolledWindow);
	pScrolledWindow->set_shadow_type(Gtk::SHADOW_OUT);
	pVBox->pack_start(*pScrolledWindow, TRUE, TRUE, 0);

	// Unkown error ....
	pScrolledWindow->add(m_Input);

	show_all();
}

FetionDialogWindow::~FetionDialogWindow()
{
}

void FetionDialogWindow::append_msg(Glib::ustring & msg)
{
	Glib::RefPtr <Gtk::TextBuffer> pTextBuffer = m_Output.get_buffer();
	pTextBuffer->insert(pTextBuffer->end(), msg);
	pTextBuffer->insert(pTextBuffer->end(), "\n");
}

